#include <core/node.hpp>
#include <core/core.hpp>

#include <commons/util/util.hpp>

#include <memory>
#include <map>

using namespace sros;

namespace sros::device
{
    class McuDevice;
    class DriverDevice;
    class RfidDevice;
    class EncoderDevice;
}

namespace sros::async
{
    class Timer;
}

namespace sros::plugins
{
    class Mqtt;
}

class PeriphDevices : public Node
{
public:
    PeriphDevices(const std::string &name = "PeriphDevices", const std::string &module = "device");
    ~PeriphDevices() = default;

    /**
     * @brief    节点初始化
     * @note     只有一个实例
     * @see
     * @param
     * @return   RetBool.v 返回加载是否成功
     *           RetBool.msg 成功msg 为空，否则msg为错误信息
     * @warning
     */
    sros::RetBool init() override;

    // 节点启动
    void run() override;

    // 节点关闭
    void close() override;

private:
    std::shared_ptr<device::McuDevice>      mcu_device_;
    std::shared_ptr<device::DriverDevice>   driver_device_; 
    std::shared_ptr<device::RfidDevice>     rfid_device_;
    std::shared_ptr<device::EncoderDevice>  encoder_device_;
    std::shared_ptr<plugins::Mqtt>          mqtt_;
    std::shared_ptr<async::Timer>           pub_timer_;
};
